<style>
	.modal-content{height:420px;}
    .li-ico{position: relative}
    .ico-info{position: absolute;right: -15px;top:0}
    .ico-info i{font-size: 15px;margin-top: 8px}
</style>
<div class="col-lg-12" style="margin-left: 10px;width: 500px; height: auto; margin-top:20px;" id="">
	<form id="AppFormAdd" action="" method="post" class="form-horizontal" data-bv-message="" data-bv-feedbackicons-valid="glyphicon glyphicon-ok" data-bv-feedbackicons-invalid="glyphicon glyphicon-remove" data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
		<div class="form-group">
         	<label class="col-lg-3 control-label">菜单上级 :<sup>*</sup></label>
            <div class="col-lg-9">
            <select name="parent_id" id="parent_id" class="form-control">
            	<option value="0">一级菜单</option>
                {volist name="roleList" id="vo"}
                <option value="{$vo.oath_id}">{$vo.name}</option>
                {/volist}
            </select>
            </div>
        </div>
        <div class="form-group">
         	<label class="col-lg-3 control-label">菜单名称 :<sup>*</sup></label>
            <div class="col-lg-9">
            <input class="form-control" id="name1" type="text" name="name" placeholder="菜单名或方法名" value="" />
            </div>
        </div>
        <div class="form-group">
         	<label class="col-lg-3 control-label">控制器/方法 :<sup>*</sup></label>
            <div class="col-lg-9">
            <input class="form-control" id="url1" type="text" name="url" placeholder="控制器/方法" value="" />
            </div>
        </div>

        <div class="form-group" id="parentIconSelect">
            <label class="col-lg-3 control-label">图标选择 :</label>
            <div class="col-lg-9">
                <select class="form-control" id="parentIconSelectItem"  >
                <option value="" >请选择</option>
                {volist name="icoList" id="vo" }
                <option onmouseover="javascript:alert('event has been triggered');">{$vo}</option>
                {/volist}
                </select>
            </div>
        </div>

        <div class="form-group li-ico" id="parentIcon">
         	<label class="col-lg-3 control-label">菜单图标 :</label>
            <div class="col-lg-9">
            <input class="form-control" type="text" name="icon" placeholder="导航栏小图标 如Home" value="">
            </div>
            <div class="ico-info">
                <i class="menu-icon {$parent.icon}"></i>
            </div>
        </div>

        
        <div class="form-group">
         	<label class="col-lg-3 control-label">菜单排序 :</label>
            <div class="col-lg-9">
           <input class="form-control" id="order" type="text" name="order" placeholder="排序"value="" />
            </div>
        </div>
		<div class="form-group">
            <div class="col-lg-offset-2 col-lg-4">
            <button id="pre1" style="margin-top: 5px;" class="btn btn-primary" type="submit">保存</button>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <button id="del1" style="margin-top: 5px;" onclick="oathDel();" class="btn btn-danger">删除</button>
            </div>
        </div>	
	</form>
</div>
<script type="text/javascript">
$(function(){
	$("#parent_id").change(function(){
		var value = $(this).val();
		if(value == 0){
			$("#parentIcon").show();
			$("#parentIconSelect").show();
		}else{
			$("#parentIcon").hide();
			$("#parentIconSelect").hide();
		}
	});
    $("#parentIconSelectItem").hover(function(){
        var value = $(this).val();
        $('#parentIcon input').val(value)
        $('.ico-info i').removeClass();
        $('.ico-info i').addClass("menu-icon "+value);
    });
});
function optionMv(obj){
  console.log(222)
}
$('#AppFormAdd').bootstrapValidator({
	submitHandler: function(validator, form, submitButton) {
		var tourl = "{:url('Dlc/role/oathSave')}";
		var data = $('#AppFormAdd').serialize();
		$.post(tourl, data, function(json) {
			if (json.status) {
				$.App.alert('success', json.msg);
				$('.close').click();
				$('#refresh-toggler').click();
			} else {
				$.App.alert('danger', json.msg);
			}
		})
	},
});

function oathDel() {
	if(confirm("确定要删除吗？")) {
		var oath_id = $('#oath_id').val();
		$.post('/Dlc/role/oathDel', {
			oath_id: oath_id
		}, function(data) {
			if (data.status == 1) {
				$.App.alert('success', data.msg);
				$('.close').click();
				$('#refresh-toggler').click();
			} else {
				$.App.alert('danger', data.msg);
			}
		})
	} else {
		return false;
	}
}   
</script>